package jia.core.calculations;

import java.util.Arrays;

/**
 * Generates the stats for each player character.  Based on the process of rolling 4D6 and dropping
 * the lowest value.  This method generally returns higher than average results when compared to other
 * rolls, but hey, they are HEROES after all..
 */
public class GenerateStat{
	public static int rollStat(){
		int retVal = 0;
		int[] mine = new int[4];
		mine[0] = Dice.roll(6, 1);
		mine[1] = Dice.roll(6, 1);
		mine[2] = Dice.roll(6, 1);
		mine[3] = Dice.roll(6, 1);

		while(mine[0] <= 2){
			mine[0] = Dice.roll(6, 1);
		}
		while(mine[1] <= 2){
			mine[1] = Dice.roll(6, 1);
		}
		while(mine[2] <= 2){
			mine[2] = Dice.roll(6, 1);
		}
		while(mine[3] <= 2){
			mine[3] = Dice.roll(6, 1);
		}

		//sort the array
		Arrays.sort(mine);




		//add the highest values, which should be the last three

			return mine[1] + mine[2] + mine[3];
	}
}
